<!DOCTYPE html>
<html>
<head>
    {include file="../application/common/header.html" /}
</head>

<body>
    <div id="student_fruit_regtb">
        <form id="student_fruit_regForm" class="m5">
            学期：
            <select class="form-control1" name="termId" id="termId"></select>
            获奖级别：
            <select class="form-control1" name="获奖级别" id="获奖级别"></select>
            获奖等第：
            <select class="form-control1" name="获奖等第" id="获奖等第"></select>
            学生姓名：
            <input class="form-control1" name="studentName" id="studentName">
            <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-search'" onclick="searchForm('student_fruit_reg')">查询</a>
            <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-clear'" onclick="resetForm('student_fruit_reg')">重置</a><br/>
        </form>
    </div>
    <table id="student_fruit_regdg">
        <thead>
            <tr>
                <th data-options="field:'ID',checkbox:true">ID</th>
                <th data-options="field:'学期ID',title:'学期名称',editor:{
                    type:'combobox',
                    options:{
                        editable:false,
                        panelHeight:'auto',
                        required:true,
                        valueField:'ID',
                        textField:'学期名称',
                        url:'/compent/Util/termList.html'
                    }
                },formatter:function(value,row,index){
                    return row.学期名称;
                }"></th>
                <th data-options="field:'竞赛名称',title:'竞赛名称',editor:{
                    type:'textbox',options:{required:true}},
                formatter: function(value, row, index) {
                    return '<span class=\'note\' title=\''+value+'\'>'+ value + '</span>';
                }"></th>
                <th data-options="field:'参赛组别',title:'参赛组别',editor:{type:'textbox'}"></th>
                <th data-options="field:'参赛子项目',title:'参赛子项目',editor:{type:'textbox'}"></th>
                <th data-options="field:'作品名称',title:'作品名称',editor:{
                    type:'textbox',options:{required:true}}"></th>
                <th data-options="field:'年级',editor:{type:'combobox',options:{editable:false,required:true,onSelect:chengguoAdminXueshengchangenianji,url:'/compent/Util/gradeList'}}">年级</th>
                <th data-options="field:'班别',editor:{type:'combobox',options:{editable:false,required:true,onSelect:chengguoAdminXueshengchangebanji}}">班别</th>
                <th data-options="field:'学生ID',formatter:function(value,row,index){return row.姓名},editor:{type:'combobox',options:{mode:'remote',required:true}}">学生</th>
                <th data-options="field:'获奖级别',title:'获奖级别',editor:{
                    type:'combobox',
                    options:{
                        editable:false,
                        panelHeight:'auto',
                        required:true,
                        valueField:'value',
                        textField:'text',
                        url:'/getTeacherFruitConf/获奖级别',
                        method:'GET'
                    }}"></th>
                <th data-options="field:'获奖等第',title:'获奖等第',editor:{
                    type:'combobox',
                    options:{
                        editable:false,
                        panelHeight:'auto',
                        required:true,
                        valueField:'value',
                        textField:'text',
                        url:'/getTeacherFruitConf/获奖等第',
                        method:'GET'
                    }}"></th>
                <th data-options="field:'获奖时间',title:'获奖时间',editor:{
                    type:'datebox',options:{required:true}}"></th>
                <th data-options="field:'授奖单位',title:'授奖单位',editor:{type:'textbox',options:{required:true}}"></th>
                <th data-options="field:'指导教师',title:'指导教师',editor:{type:'textbox'}"></th>
                <th data-options="field:'加分',title:'加分',editor:{type:'numberbox'}"></th>
                <th data-options="field:'备注',title:'备注',width:200,editor:{type:'textbox'},
                formatter: function(value, row, index) {
                    return '<span class=\'note\' title=\''+value+'\'>'+ value + '</span>';
                }"></th>
            </tr>
        </thead>
    </table>

    <script type="text/javascript">
        $(function(){
            var url = "/fruit/student_fruit_reg";
            initDatagridAdmin("student_fruit_reg",url,1,1,1,1,1);
            termList("student_fruit_reg");
            getTeacherFruitConf("student_fruit_reg","获奖级别");
            getTeacherFruitConf("student_fruit_reg","获奖等第");
        })  
        function chengguoAdminXueshengchangenianji(record){
            var url="/compent/Util/clazzList.html?grade="+record.value;
            var ed=$('#student_fruit_regdg').datagrid('getEditor',{index:dgEditIndex['student_fruit_reg'],field:'班别'}); 
            $(ed.target).combobox('setValue',"");
            $(ed.target).combobox('reload',url);
        }
        function chengguoAdminXueshengchangebanji(record){
            var ed=$('#student_fruit_regdg').datagrid('getEditor',{index:dgEditIndex['student_fruit_reg'],field:'年级'});
            var njh=$(ed.target).combobox('getValue');  
            var url="/compent/Util/studentList.html?grade="+njh+"&clazz="+record.value;
            var ed=$('#student_fruit_regdg').datagrid('getEditor',{index:dgEditIndex['student_fruit_reg'],field:'学生ID'});   
            $(ed.target).combobox('setValue',"");
            $(ed.target).combobox('reload',url);
        }
    </script>
</body>
</html>